/*
 * @Author: leevan
 * @Date: 2022-02-11 14:47:06
 * @LastEditTime: 2022-02-11 14:49:19
 * @LastEditors: leevan
 * @FilePath: /usermanagecenter/src/service/user.service/index.js
 */

import {
    userList_path,
    addUser_path,
    getUserDetail_path,
    getUseRoleList_path,
    enableUser_path,
    disabledUser_path,
    resetPwd_path,
    delUser_path,
    logout_path,
    userPaging_path,
    register_path,
    approvalUser_path,
    updateLoginUser_path,
    updateUserPwd_path,
    getLoginUserDetail_path,
} from './path';

import {
    POST , GET , PATCH, DELETE,PUT
} from '@/plugins/axios';


//组织机构下的用户列表
export const userList = (data)=> {
    return GET(userList_path() , data);
};
//修改密码
export const updateUserPwd = (data)=> {
    return GET(updateUserPwd_path() , data);
};
//注册
export const register = (data)=> {
    return PUT(register_path() , data , {'content-type' : "application/json"});
};
//退出登录
export const logout = ()=> {
    return GET(logout_path());
};
//修改登录用户的个人信息
export const updateLoginUser = (data)=> {
    return PATCH(updateLoginUser_path(), data , {'content-type' : "application/json"});
};
//删除用户
export const delUser = (userId)=> {
    return DELETE(delUser_path(userId));
};
//新增用户
export const addUser = (data)=> {
    return POST(addUser_path() ,data, {'content-type' : 'application/json'});
};
//跟新用户
export const updateUser = (data)=> {
    return PATCH(addUser_path() ,data, {'content-type' : 'application/json'});
};
//获取用户详情
export const getUserDetail = (userId = '')=> {
    return GET(getUserDetail_path(userId));
};
//低权限用户 获取用户详情
export const getLoginUserDetail = (userId = '')=> {
    return GET(getLoginUserDetail_path(userId));
};
//获取用户关联角色列表
export const getUseRoleList = (userId = '')=> {
    return GET(getUseRoleList_path(userId));
};
//用户启用
export const enableUser = (userId = '')=> {
    return GET(enableUser_path(userId));
};
//用户停用
export const disabledUser = (userId = '')=> {
    return GET(disabledUser_path(userId));
};
//用户重置密码
export const resetPwd = (userId = '' , passwd = '')=> {
    return GET(resetPwd_path() , { userId : userId , passwd : passwd});
};
//已授权用户列表
export const userPaging = (data)=> {
    return GET(userPaging_path() , data);
};
//审批用户
export const approvalUser = (data = {}) => {
    return PUT(approvalUser_path() , data , {'content-type' : 'application/json'});
};
